#include<stdio.h>
#include<string.h>
int main(int argc, char const *argv[])
{
    char ch;
    int count=0;
    FILE *fp = fopen("2.txt","r");
    if(fp == NULL)
    {
        printf("文件打开失败");
        return -1;
    }

    for (size_t i = 0; EOF!=(ch = fgetc(fp)); i++)
    {
        if(ch == '\n')
        count++;
    }
    printf("%d\n",count);

    fclose(fp);
    fp = NULL;

    return 0;
}
